<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>computed</title>
    <script type="text/javascript" src="../assets/js/vue-2.3.0.js"></script>
</head>
<body>
    <h1>computed计算属性</h1>
    <hr>
    <div id="app">
        <div>苹果{{newprice}}</div>
        <div>{{newmsg}}</div>
    </div>
</body>
<script type="text/javascript">
    var app = new Vue({
        el:'#app',
        data:{
            price: '9.9',
            msg:'hello'
        },
        computed:{
            newprice:function(){
                return this.price='¥'+this.price+'元'
            },
            newmsg:function(){
                return this.msg.split('').reverse().join('')
            }
        }
    })
</script>
</html>